<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="css/site.css" />
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@1.6/lib/index.css">
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/vant@1.6/lib/vant.min.js"></script>
		<title>请输入新密码</title>
		<style>
			.xgyanzheng{
				margin-top: 20px;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<van-row>
				<van-col span="24">
					<van-nav-bar id="S_bar" fixed=true title="请输入新密码" right-text="完成" left-arrow @click-left="onClickLeft" @click-right="onClickRight"></van-nav-bar>
				</van-col>
				<van-col span="24">
					<van-row>
						<van-col span="21" offset="1" class="xgyanzheng">
							<van-cell-group>
								<van-field type="password" v-model="paw" placeholder="请输入新密码"></van-field>
								<van-field type="password" v-model="conpaw" placeholder="请确认新密码"></van-field>
							</van-cell-group>
						</van-col>
					</van-row>
				</van-col>
			</van-row>
		</div>
		<script src="js/ajax.js"></script>
		<script src="html5plus://ready"></script>
		<script>
			var vm = new Vue({
				el: "#app",
				data: {
					paw: "",
					conpaw:""
				},
				methods: {
					onClickLeft: function() {
						plus.webview.close(plus.webview.currentWebview(),"slide-out-left");
					},
					onClickRight: function() {
						ajax({
						url: "http://dsapi.ysd3g.com/api/ResetPassword",
							dataType: "jsonp",
							data: {
								phone: plus.webview.currentWebview().phone,
								password: vm.paw
							},
							success(res) {
								console.log(res)
								if (res.Error) {
									vm.$toast.fail(res.Msg);
								} else{
									alert("修改成功");
									plus.webview.show("login","slide-in-right");
									plus.webview.close(plus.webview.currentWebview(),"slide-out-left");
								}
							}
						})
					}
				}
			})
		</script>
	</body>
</html>
